The purpose of Manual Add/Import is to support managing resources that
-
cannot be auto-discovered for some unknown reason by the plugin
-
that are currently offline.
More specifically see the excerpt from the ManualAddFacet below:
* This allows a discovery component to support Resources being manually added. A manual add is initiated when a GUI user
* goes to the Child Resources section of the Resource's Inventory>Overview tab and chooses to manually add a new child
* Resource. The user then specifies the connection properties (i.e. plugin configuration) that should be used to
* to connect to the Resource. A request is then sent to the Plugin Container, which calls the {@link #discoverResource}
* method on the discovery component. The option to manually add a Resource is only exposed by the GUI for Resource
* types defined with supportsManualAdd="true" in the plugin descriptor. Manual add is used either to add an offline
* managed resource to inventory or to add a managed resource that could not be auto-discovered for some reason.
Manual add was added so that RHQ administrators could rectify issues getting their managed resources added via the GUI. This has worked well for plugins implementing this facet, but what is not well described is what should happen when a new plugin configuration happens to map to a resource that is already known to the RHQ database. More specifically, what should happen when I'm trying to add a new Tomcat server to RHQ and the plugin config generates an identifier that maps to a different Tomcat resource already in inventory? one possible answer is that such an operation should fail since it's already been added/imported. But what happens if instead the identifier mapped to a different resource that was currently being ignored? Deleted? There should be no ambiguity here about how a manual import affects resources that are already indexed.
Inventory Status states summarized:
* <li>NEW: Auto-discovered but not yet imported into the inventory.</li>
*
* <li>IGNORED: Auto-discovered but explicitly moved to a state that will suppress it from showing up in future
* discoveries. Resources in this state will not be shown in the inventory browser.</li>
*
* <li>COMMITTED: Resources in this state will be visible in the inventory browser. The act of importing
* resources changes their state from NEW to COMMITTED. Note: resources that are factory-created
* or manually added will also appear in the inventory browser and, thus, will be COMMITTED.</li>
*
* <li>DELETED: Resources can be removed from the remote box, which will flip their status to DELETED to suppress
* them from showing up in the inventory browser.</li>
*
* <li>UNINVENTORIED: Resources can be removed from the inventory. Since this is an expensive operation, these
* resources are temporarily marked as UNINVENTORIED which will suppress them from showing up
* in the inventory browser. Then, in the background, all history will be purged for these
* resources, after which they are removed from the database completely.</li>
Current Behavior
RI - Resource in database RM - Resource being manually added
UNINVENTORIED state is a special state that we can completely ignore. The path with that status is identical to NEW.
Inventory
|
Manual Add
|
Result
|
N/A
|
RM
|
RM added
|
RI in NEW
|
RM
|
AD Queue. i)Looses new plugin config ii) attempts to apply AD Plugin Config but fails. Incorrect behavior
|
RI in IGNORED
|
RM
|
AD Queue. i)Looses new plugin config ii) attempts to apply AD Plugin Config but fails. Incorrect behavior
|
RI in DELETED
|
RM
|
Nothing happens. Existing resource is not affected and no new one is added despite successful operation. ?
|
RI in COMMITTED
|
RM
|
No-op. New plugin config is replaced with one from inventory. No change.
|
There are several flaws with the current release implementation:
-
The InventoryManager attempts to detect existing resources with the same plugin configuration identifier and only if NOT COMMITTED, then tries to apply the latest plugin config. This does not address that NEW/IGNORED/DELETED are distinctly different states which may need to be treated differently.
-
The exposed remote api for Manual Add promises to return the existing Resource(regardless of inventory status) if the plugin configuration identifies a previously indexed resource. That implies certain configuration/status after manual import that is unclear.
-
This whole approach assumes that the UI/api users understand the various different details of InventoryStatus(NEW,IGNORED,DELETED,COMMITTED). The users shouldn't have to to successfully import their resources.
-
The autodiscovery queue can i) hold onto a resource(NEW) state even after that process has been shut down, unknown to the user. You'll need to try to import that resource into RHQ and then remove to clear that up. This is a confusing state to an administrator which can scan the process table and see no current processes for their managed resource.
-
What should happen when a resource has already been indexed and is in one of the following states is unclear: (IGNORED,DELETED) since in each case the user has made explicit requests to put that same resource in a different state before now attempting to manually add it. If we take a step back the RHQ administrator is now attempting to apply contradictory states to the same resources. Before they had explicitly marked the given resource as either IGNORED or DELETED. By attempting a manual add using a key that had already existed they're now requesting that the same resource be brought back into the inventory, which is contradictory to the first point and likely unintentional.
What is the customer looking for?
That is a great question here. There are several competing opinions in the absence of real input from customers on this one:
-
If my manual add requests conflict it should fail indicating the customer should use existing plugin configuration update ui/apis available.
-
If my manual add request maps to an existing resource for any reason then RHQ should take this new state as the correct one.
-
If my manual add request maps to an existing resource RHQ should try to do what makes sense here even though this behavior is currently covered by resource update workflows.
While not an actual customer, the EWS team had this to say about their thoughts on implied behavior:
> Import. Can you indicate what do you think the EWS customers would
> expect to be a valid response if they tried to Manually Add a Tomcat
> instance that was already in inventory?
Would it be possible to have a error telling it is already in the inventory?
> How about a resource that
> they'd marked as IGNORED? Or marked as DELETED in the RHQ UI?
It is possible to detect it and have a error message that tells that
they may be doing something wrong and point they to either already
"marked as IGNORED" or "marked as DELETED" so they can UN-IGNORE and
UN-DELETE the tomcat?
>
> These are questions that are not well described by our current
> interface. Can you provide some feedback from the EWS perspective?
I only use JON/RHQ to check and fix the BZ reported to me, my feelings
are that the basic operations are already not easy to do and things like
manual import are for experienced users or special cases where the
automatic stuff doesn't work may be something in the frame should tell
"experienced users / special cases only".
Specification of behaviors after the proposed changes.
Lukas' suggestion
RI - Resource in database RM - Resource being manually added
UNINVENTORIED state is a special state that we can completely ignore. The path with that status is identical to NEW.
Inventory
|
Manual Add
|
Result
|
N/A
|
RM
|
RM added
|
RI in NEW
|
RM
|
RM overwrites Ri and moves it to COMMITTED
|
RI in IGNORED
|
RM
|
RM overwrites Ri and moves it to COMMITTED
|
RI in DELETED
|
RM
|
RM updates Ri and moves it to COMMITTED
|
RI in COMMITTED
|
RM
|
Error during manual add
|
Spinder's suggestion
RI - Resource in database RM - Resource being manually added
Inventory
|
Manual Add
|
Result
|
N/A
|
RM
|
RM added
|
RI in NEW
|
RM
|
Error out. i)UI message: already auto-discovered try import. i) Link to auto-discovery queue
|
RI in IGNORED
|
RM
|
Error out. i)UI message: You've identified a resource that you've already ignored. Link to unignored?
|
RI in DELETED
|
RM
|
Error out. i)UI message: You've identified a resource that you've already deleted. Link to deleted?
|
RI in COMMITTED
|
RM
|
Error during manual add. i)UI message: You've identified a resource that is already in inventory. Link to Resource.
|
-
This approach advocates clearer distinction between Manual Import and existing plugin update mechanisms. The two should be distinctly different processes.
-
Implies documentation/support messaging changes where appropriate.
Jay's suggestion
RI - Resource in database RM - Resource being manually added
UNINVENTORIED state is a special state that we can completely ignore. The path with that status is identical to NEW.
Inventory
|
Manual Add
|
Result
|
N/A
|
RM
|
RM added
|
RI in NEW
|
RM
|
RM overwrites Ri and moves it to COMMITTED
|
RI in IGNORED
|
RM
|
Throw exception.
|
RI in DELETED
|
RM
|
?
|
RI in COMMITTED
|
RM
|
Update the resource configuration.
|